// 核心混合器
// 从global.scss中提取的混合器

// 弹性布局
@mixin flex($direction: row, $justify: flex-start, $align: center) {
  display: flex;
  flex-direction: $direction;
  justify-content: $justify;
  align-items: $align;
}

// 文本溢出省略
@mixin text-ellipsis($lines: 1) {
  @if $lines == 1 {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  } @else {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: $lines;
    overflow: hidden;
  }
}

// 绝对定位居中
@mixin absolute-center($position: both) {
  position: absolute;
  @if $position == both {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
  } @else if $position == horizontal {
    left: 50%;
    transform: translateX(-50%);
  } @else if $position == vertical {
    top: 50%;
    transform: translateY(-50%);
  }
}

// 清除浮动
@mixin clearfix {
  &::after {
    content: '';
    display: table;
    clear: both;
  }
}

// 滚动条样式
@mixin scrollbar($width: 6px, $track-color: #f0f0f0, $thumb-color: #ddd) {
  &::-webkit-scrollbar {
    width: $width;
    height: $width;
  }
  
  &::-webkit-scrollbar-track {
    background: $track-color;
    border-radius: 3px;
  }
  
  &::-webkit-scrollbar-thumb {
    background: $thumb-color;
    border-radius: 3px;
    
    &:hover {
      background: darken($thumb-color, 10%);
    }
  }
}

// 响应式断点
@mixin mobile {
  @media (max-width: 767px) {
    @content;
  }
}

@mixin tablet {
  @media (min-width: 768px) and (max-width: 991px) {
    @content;
  }
}

@mixin desktop {
  @media (min-width: 992px) {
    @content;
  }
} 